package com.azure.bigstore.controller;

import com.azure.bigstore.entity.Product;
import com.azure.bigstore.service.OrderItemService;
import com.azure.bigstore.service.OrderService;
import com.azure.bigstore.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.persistence.Tuple;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by liuhuaibin on 2018/1/22.
 */
@RestController
@RequestMapping("/v1")
public class HotController {
    @Autowired
    private ProductService productService;
    @Autowired
    private OrderItemService orderItemService;

    @GetMapping("/hot")
    public List<Product> getHot(){
        List<Long> ids = orderItemService.getPids();
        System.out.println(" hot ids:"+ids.toString());

        return productService.getHotProducts(ids);
//        return null;
    }
}
